import request from '@/utils/request'

// 获取组织结构信息
export const getDepartments = () => {
  return request({
    url: '/company/department'
  })
}

// 删除部门
export const delDepartments = (id) => {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

// 添加部门
export const addDepartments = (data) => {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

// 获取部门详情
/**
 *
 * @param {*} id  当前部门的id
 */
export const getDeptList = (id) => {
  return request({
    url: '/company/department/' + id,
    method: 'GET'
  })
}

// 编辑部门
export const editDeptList = (data) => {
  return request({
    url: '/company/department/' + data.id,
    method: 'PUT',
    data
  })
}
